const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  devServer: {
    compress: true,
    port: 2020,
  },
  pages: {
    // 将 examples 目录添加为新的页面
    index: {
      entry: "examples/main.js", // page 的入口
      template: "public/index.html", // 模板来源
      filename: "index.html", // 输出文件名
    },
  },
  publicPath: "./",
  chainWebpack: (config) => {
    config.resolve.alias
      .set("packages", resolve("packages"))
      .set("@", resolve("examples"));
  },
};
